﻿using Dcm.ConfigMapAttributes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dcm.Tests.ConfigMapAttributes
{
    [TestClass]
    public class AssemblyPathRegExTests
    {
        const string ConfigMapAttributeName = "assemblyPathRegEx";

        [TestInitialize()]
        public void Startup()
        {
            Debug.WriteLine(AssemblyPathRegEx.GetAssemblyPath());
        }

        [TestMethod]
        public void AssemblyPathRegExHappy()
        {
            const string Expected = "Success";
            var actual = DynamicConfigurationManager.DynamicConfigurationManager.AppSettings["assemblyPathRegExKey"];
            
            if (actual != Expected)
            {
                Debug.WriteLine(DynamicConfigurationManager.DynamicConfigurationManager.Log);
                Assert.Inconclusive(Utilities.UnreliableTest);
            }
            else
                Assert.AreEqual(Expected, actual);
        }

        [TestMethod]
        public void AssemblyPathRegExMisMatch()
        {
            const string Expected = null;
            var actual = DynamicConfigurationManager.DynamicConfigurationManager.AppSettings["assemblyPathRegExBad"];
            Assert.AreEqual(Expected, actual);
        }
    }
}
